home *** CD-ROM | disk | FTP | other *** search
- <%@ page language="java" import="
- java.util.*,
- com.jproxy.site.mbeans.*,
- com.jproxy.site.mbeans.config.*,
- com.jproxy.site.ejbeans.interfaces.IPurchase,
- com.jproxy.site.*"
- errorPage="../error-page.jsp"
- %>
-
- <jsp:useBean id="ses" scope="session" class="com.jproxy.site.JSPSession"/>
- <%
- if (!ses.isLoggedIn()) {
- %>
- <jsp:forward page="login.jsp">
- </jsp:forward>
- <%
- }
- ses.request(pageContext);
- %>
-
- <%
- String APPROVED = "1";
- String DECLINED = "2";
- String ERROR = "3";
-
- String customerID = ses.getParameter("customer-id");
- String parentID = ses.getParameter("parent-id");
- String x_response_code = request.getParameter("x_response_code");
- if(x_response_code==null)
- x_response_code = APPROVED;
- String x_response_reason_code = request.getParameter("x_response_reason_code");
- if(x_response_reason_code==null)
- x_response_reason_code = APPROVED;
- if(!(x_response_code.equals(APPROVED) && x_response_reason_code.equals(APPROVED)))
- {
- String x_response_reason_text = request.getParameter("x_response_reason_text");
-
- String descr = "[Purchase]: x_response_reason_text: "+x_response_reason_text+"\r\n";
- String x_avs_code = request.getParameter("x_avs_code");
- if(x_avs_code==null)
- x_avs_code = "";
- if(x_avs_code.indexOf("A")!=-1)
- descr += "Address (Street) matches, ZIP does not \r\n";
- if(x_avs_code.indexOf("E")!=-1)
- descr += "AVS error \r\n";
- if(x_avs_code.indexOf("N")!=-1)
- descr += "No Match on Address (Street) or ZIP \r\n";
- if(x_avs_code.indexOf("P")!=-1)
- descr += "AVS not applicable for this transaction \r\n";
- if(x_avs_code.indexOf("R")!=-1)
- descr += "Retry. System unavailable or timed out \r\n";
- if(x_avs_code.indexOf("S")!=-1)
- descr += "Service not supported by issuer \r\n";
- if(x_avs_code.indexOf("U")!=-1)
- descr += "Address information is unavailable \r\n";
- if(x_avs_code.indexOf("W")!=-1)
- descr += "9 digit ZIP matches, Address (Street) does not \r\n";
- if(x_avs_code.indexOf("X")!=-1)
- descr += "Exact AVS Match \r\n";
- if(x_avs_code.indexOf("Y")!=-1)
- descr += "Address (Street) and 5 digit ZIP match \r\n";
- if(x_avs_code.indexOf("Z")!=-1)
- descr += "5 digit ZIP matches, Address (Street) does not \r\n";
- System.out.println(descr);
- %>
- <jsp:forward page="buy.jsp">
- <jsp:param name="error" value="<%=descr%>"/>
- </jsp:forward>
- <%
- }
- String customer_name = request.getParameter("x_first_name");
- customer_name += " "+request.getParameter("x_last_name");
- String phone = request.getParameter("x_phone");
- String company = request.getParameter("x_company");
- String address = request.getParameter("x_address");
- address += " "+request.getParameter("x_city");
- address += " "+request.getParameter("x_state");
- address += " "+request.getParameter("x_zip");
- address += " "+request.getParameter("x_country");
- String email = request.getParameter("x_email");
- String trans_id = request.getParameter("x_trans_id");
- int number_of_licenses = 0;
- double amount = 0;
- String purchased_product = "";
- int invoice = 15;
- String discount_policy = "";
-
- try{
- number_of_licenses = Integer.parseInt(request.getParameter("number_of_licenses"));
- }catch(Exception ee){}
- try{
- amount = new Double(request.getParameter("x_amount")).doubleValue();
- }catch(Exception ee){}
-
-
- try{
- invoice = Integer.parseInt(request.getParameter("x_invoice_num"));
- }
- catch(Exception e){
- }
-
- ConfigMBean mbean = (ConfigMBean)JMXInvocator.getMBean(
- "JProxy:service=JProxyConfigMBean", ConfigMBean.class);
- mbean.edit("com.jproxy.commerce.invoice", ""+(invoice+1));
-
- // purchased_product = mbean.get("com.jproxy.proxy.name")+" "+mbean.get("com.jproxy.proxy.version");
- // purchased_product = "JProxy Server 1.0";
- purchased_product = ses.getParameter("productid");
-
- try
- {
- IPurchase pb = ses.session.createNewPurchase();
- pb.setCommand(purchased_product);
- pb.setAmount(amount);
- pb.setNumberOfLicenses(number_of_licenses);
- pb.setCustomerID(customerID);
- pb.setCustomerName(customer_name);
- pb.setCompany(company);
- pb.setEMail(email);
- pb.setAddress(address);
- pb.setPhone(phone);
- pb.setDiscountPolicy(discount_policy);
- pb.setTransID(trans_id);
- pb.setInvoiceNumber(invoice);
- /*
- Properties p = new Properties();
- p.put("purchased_product", purchased_product);
- p.put("amount", ""+amount);
- p.put("number_of_licenses", ""+number_of_licenses);
- p.put("customer_id", ""+customerID);
- p.put("customer_name", customer_name);
- p.put("company", company);
- p.put("email", email);
- p.put("address", address);
- p.put("phone", phone);
- p.put("discount_policy", discount_policy);
- p.put("trans_id", trans_id);
- p.put("invoice", ""+invoice);
- ses.setNewHit(ses.pc, "purchases", purchased_product, p);
- */
- }catch(Exception ee){ee.printStackTrace();}
-
- // String file = "proxycomm.zip";
- String forwardPage = "index.html";
-
- // EMailMe bean = new EMailMe();
- // bean.request(request);
- // bean.emailFile(email, purchased_product, file);
- %>
-
- <!-- HEADER -->
- <jsp:include page="../header.jsp" flush="true"/>
-
- <!-- MAIN PANEL -->
-
- <table border=0 width="100%">
- <tr>
- <td width="100%" valign="top">
-
- <div align="center">Thank you for shopping with us! Please allow of up to 12 hours for
- the product(s) and the license keys to arrive in your mail box.
- <p>
- If you have any further questions please contact us at
- <a class="h8VerdanaBold" href="mailto:<%=JSPRes.salesSupport%>"><%=JSPRes.salesSupport%></a>
- </div>
- <p>
-
- <p>customer_name: $<%=customer_name%></p>
- <p>company: $<%=company%></p>
- <p>address: $<%=address%></p>
- <p>email: $<%=email%></p>
- <p>phone: $<%=phone%></p>
- <p>number_of_licenses: $<%=number_of_licenses%></p>
- <p>amount: $<%=amount%></p>
- <p>trans_id: $<%=trans_id%></p>
- </td>
- </tr>
- </table>
-
- <jsp:include page="../footer.jsp" flush="true"/>
-